﻿using System;
using System.Data;
using ZX.Web.UI.Controls;
using System.Text;
using ZX.CRM.Bussiness;

namespace ZX.WebApp.DeskTop.DeskTopItem
{
    public partial class SPCount : BasePage
    {
        BCrmReport BReport = new BCrmReport();
        protected void Page_Load(object sender, EventArgs e)
        {
            getdt();
        }

        private int getPowerType
        {
            get
            {
                int powertype = 0;
                if (Request["PowerType"] == null || Request["PowerType"] == "" || Request["PowerType"] == "0")
                    powertype = 0;
                else
                    powertype = 1;
                return powertype;
            }
        }

        public void getdt()
        {
            var htmlTemp = "";
            htmlTemp += "<div style='width:100%;height:90%;overflow:auto;'><table class='tableContent' cellspacing='0'>";
            htmlTemp += "    <tr><th style='width:35%;border-left:1px solid #C1DAD7;'>周期</th>";
            htmlTemp += "    <th style='width:25%;'>销售总额</th>";
            htmlTemp += "    <th style='width:20%;'>回款总额</th>";
            htmlTemp += "    <th style='width:20%;'>目标</th></tr>";

            DataTable MyDataTable = new DataTable();
            StringBuilder sb=new StringBuilder();
            MyDataTable = BReport.ReturnSPCountReport(new Guid(this.UserId.ToString()), getPowerType);

            if (MyDataTable.Rows.Count > 0)
            {
                foreach (DataRow row in MyDataTable.Rows)
                {
                    htmlTemp += "<tr><td style='border-left:1px solid #C1DAD7;'>" + row["title"].ToString() + "</td>";
                    htmlTemp += "<td>" + row["ProductAccountReceivable"].ToString() + "</td>";
                    htmlTemp += "<td>" + row["ProductPayAll"].ToString() + "</td>";
                    htmlTemp += "<td>......</td></tr>";
                }
            }
            else
            {
                htmlTemp += "<tr><td colspan='4' style='border-left:1px solid #C1DAD7;'>没有数据...</td></tr>";
            }
            htmlTemp += " </table></div>";

            Response.Clear();
            Response.Write(htmlTemp);
            Response.End();
        }
    }
}